package ddmzs.test;

import java.util.Scanner;

public class SolarTerms {
    public static void main(String[] args) {
        String terms = "立春、雨水、惊蛰、春分、清明、谷雨、" +
                "立夏、小满、芒种、夏至、小暑、大暑、" +
                "立秋、处暑、白露、秋分、寒露、霜降、" +
                "立冬、小雪、大雪、冬至、小寒、大寒";
        // 分割字符串
        String[] termArray = terms.split("、");
        // 输出分割后的节气数组
        for (String term : termArray) {
            System.out.print(term + " ");
        }
        Scanner scanner = new Scanner(System.in);
        System.out.print("请输入序号(1~24)：");
        int index = scanner.nextInt();
        if (index >= 1 && index <= 24) {
            System.out.println(termArray[index - 1]);
        } else {
            System.out.println("输入序号不在1~24范围内");
        }
    }
}
